View Full Version : Simple PHP help, Echo and html.
Andrew2
August 24th, 2008, 05:50 AM
Can anyone edit this so I don't have to always put \ before a quotation mark and "; at the end of every line? It gets confusing, Marshall mentioned before that there was something I could do so I didn't have to have that all the time and I can just use normal HTML with less confusion or something. If anyone knows it would be VERY VERY appreciated if you can help :) Like maybe ONE echo? I know it should be an easy fix but I really don't know PHP, I just know how to edit it until it explodes in my face, then I try again :P
if(!isset($INPUT1)) {
echo "\n<form action=\"simple-multi.php\" method=\"get\">\n";
echo "Input <input type=\"text\" value=\"1\" name=\"1\" size=\"40\"><br /><br />\n";
echo "Input <input type=\"text\" value=\"2\" name=\"2\" size=\"40\"><br /><br />\n";
echo "Input <input type=\"text\" value=\"3\" name=\"3\" size=\"40\"><br /><br />\n";
echo "Input <input type=\"text\" value=\"4\" name=\"4\" size=\"40\"><br /><br />\n";
echo "Input <input type=\"text\" value=\"5\" name=\"5\" size=\"40\"><br /><br />\n";
echo "<input type=\"submit\" value=\"Generate!\"><br />\n";
echo "</form>\n";
} else {
echo clean($1);
echo clean($2);
echo clean($3);
echo clean($4);
echo clean($5);
}
Nora
August 24th, 2008, 05:54 AM
I think you should edit the clean function to do that.
Can't really remember what it was that required them.
Something with stripslashes or addslashes maybe?
Andrew2
August 24th, 2008, 05:56 AM
I don't know :-/
I just edit a simple php form thing and edit/copy and paste what I need. I don't know the first thing about PHP or how to set it up.
Nora
August 24th, 2008, 06:02 AM
Oh I'm so stupid, I think I misunderstood what you wanted. Just turn it into plain html if you don't want to add backslashes to the form html. That's only required if you want to make it show using php.
if(!isset($INPUT1)) { ?>
just use the normal html code for the form without slashes
<?
}
Just close the php tag before it and open it after it..
Andrew2
August 24th, 2008, 07:55 AM
Tried but produces an error, If anyone else has any suggestions I'm all years. Thank you for your help so far Nora.
Smurfwicked
August 24th, 2008, 08:11 AM
Tried but produces an error, If anyone else has any suggestions I'm all years. Thank you for your help so far Nora.
I don't know of a way around what you're asking. But if you're just looking for a way to quickly convert plain html into a format to be echo'd in php I'm pretty sure there's a type of generator for that (pretty sure I've used one before). Would that work/help?
Andrew2
August 24th, 2008, 08:18 AM
That would be helpful I suppose.
1 quick question though, Do I sincerely need all these Echos? That's my main problem, it's each echo that usually confuses me.
Like:
{
echo "\n<form action=\"simple-multi.php\" method=\"get\">\n";
echo "Input <input type=\"text\" value=\"1\" name=\"1\" size=\"40\"><br /><br />\n";
echo "Input <input type=\"text\" value=\"2\" name=\"2\" size=\"40\"><br /><br />\n";
echo "Input <input type=\"text\" value=\"3\" name=\"3\" size=\"40\"><br /><br />\n";
echo "Input <input type=\"text\" value=\"4\" name=\"4\" size=\"40\"><br /><br />\n";
echo "Input <input type=\"text\" value=\"5\" name=\"5\" size=\"40\"><br /><br />\n";
echo "<input type=\"submit\" value=\"Generate!\"><br />\n";
echo "</form>\n";
}
Isnt there a way to just have it so I can do something like:
echo{
<form action="simple-multi.php" method="get">
Input <input type="text" value="1" name="1" size="40"><br />
Input <input type="text" value="2" name="2" size="40"><br />
Input <input type="text" value="3" name="3" size="40"><br />
Input <input type="text" value="4" name="4" size="40"><br />
Input <input type="text" value="5" name="5" size="40"><br />
<input type="submit" value="Generate!">
</form>
}
Smurfwicked
August 24th, 2008, 08:24 AM
That would be helpful I suppose.
1 quick question though, Do I sincerely need all these Echos? That's my main problem, it's each echo that usually confuses me.
Like:
{
echo "\n<form action=\"simple-multi.php\" method=\"get\">\n";
echo "Input <input type=\"text\" value=\"1\" name=\"1\" size=\"40\"><br /><br />\n";
echo "Input <input type=\"text\" value=\"2\" name=\"2\" size=\"40\"><br /><br />\n";
echo "Input <input type=\"text\" value=\"3\" name=\"3\" size=\"40\"><br /><br />\n";
echo "Input <input type=\"text\" value=\"4\" name=\"4\" size=\"40\"><br /><br />\n";
echo "Input <input type=\"text\" value=\"5\" name=\"5\" size=\"40\"><br /><br />\n";
echo "<input type=\"submit\" value=\"Generate!\"><br />\n";
echo "</form>\n";
}
Isnt there a way to just have it so I can do something like:
echo{
<form action="simple-multi.php" method="get">
Input <input type="text" value="1" name="1" size="40"><br />
Input <input type="text" value="2" name="2" size="40"><br />
Input <input type="text" value="3" name="3" size="40"><br />
Input <input type="text" value="4" name="4" size="40"><br />
Input <input type="text" value="5" name="5" size="40"><br />
<input type="submit" value="Generate!">
</form>
}
No I'm pretty sure you don't need all those, if you paste what you put in that second code box on to this site:
http://corz.org/public/machine/source/php/tag-tools.php
And then use "convert html to php echo ("" double quoted echo)" button, I think it'll give you what you're needing from it.
Nora
August 24th, 2008, 08:24 AM
That would be helpful I suppose.
1 quick question though, Do I sincerely need all these Echos? That's my main problem, it's each echo that usually confuses me.
Like:
{
echo "\n<form action=\"simple-multi.php\" method=\"get\">\n";
echo "Input <input type=\"text\" value=\"1\" name=\"1\" size=\"40\"><br /><br />\n";
echo "Input <input type=\"text\" value=\"2\" name=\"2\" size=\"40\"><br /><br />\n";
echo "Input <input type=\"text\" value=\"3\" name=\"3\" size=\"40\"><br /><br />\n";
echo "Input <input type=\"text\" value=\"4\" name=\"4\" size=\"40\"><br /><br />\n";
echo "Input <input type=\"text\" value=\"5\" name=\"5\" size=\"40\"><br /><br />\n";
echo "<input type=\"submit\" value=\"Generate!\"><br />\n";
echo "</form>\n";
}
Isnt there a way to just have it so I can do something like:
echo{
<form action="simple-multi.php" method="get">
Input <input type="text" value="1" name="1" size="40"><br />
Input <input type="text" value="2" name="2" size="40"><br />
Input <input type="text" value="3" name="3" size="40"><br />
Input <input type="text" value="4" name="4" size="40"><br />
Input <input type="text" value="5" name="5" size="40"><br />
<input type="submit" value="Generate!">
</form>
}
You don't but that's not the problem with the script.
You're cleaning the wrong variables.
Andrew2
August 24th, 2008, 08:28 AM
Thanks for the link Joey and the help via PM Nora :D My problem is now solved.
vBulletin® v3.7.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.