php - Using one form to fill in two other forms -



php - Using one form to fill in two other forms -

ok have 2 different types of forms , want utilize 1 form submit them both. using auto-responder form form1 fields= first, lastly , email. sec form contact me form fields= name. email , body field. trying utilize both these forms @ 1 shot. have form post fields each form (index.php) problem not sure how set form 1 post fields form1 , form2 way want. want utilize fields match form index.php both other forms (form1, form2). name , email go both forms , body field go form2. main form post first , lastly in name field of form2....also can see form 1 , 2 each form has sort of redirect page need work around.? have main form:

index.php

<html> <head> <title>main form</title> </head> <body> <h2>winner aution item request form</h2> <p><span class="error"><font><font color="red">* required field.</font></span></p> <form method="post" action="<?php echo htmlspecialchars($_server["php_self"]);?>"> first name: <input type="text" name="first_name" value="<?php echo $first_name;?>"> <font><font color="red"> *</font> <br> lastly name: <input type="text" name="last_name" value="<?php echo $last_name;?>"> <font><font color="red"> *</font> <br> e-mail: <input type="text" name="email" value="<?php echo $email;?>"> <font><font color="red"> *</font> <br><br><i><b>copy , paste auction item name below.</b></i><br> product name: <input type="text" name="product_name" rows="1" cols="10"> <?php echo $product_name;?><font><font color="red"> *</font> <input type="submit" value="submit" name="submit"></input> </form> </body> </html>

the above form found on website , pretty close want not exactly.... form1

<?php session_start(); ?> <html> <head> <title>autoresponder</title> </head> <body> <center> <table cellspacing="10" bgcolor="#cccccc" style="border: 0px solid #000000;"> <tr><td> <form action="http://newsletter.jeremyahenry.com//s.php" method=get> <strong><font color="#660000">your first name:</font></strong> <input type="text" name="f" style="background-color : #ffffff" size=11 maxlength=40><br> <strong><font color="#660000">your lastly name:</font></strong> <input type="text" name="l" style="background-color : #ffffff" size=11 maxlength=40><br> <strong><font color="#000066">email address:</font></strong><br> <input type="text" name="e" style="background-color : #ffffff" size=20 maxlength=50> <input type="image" src="http://blog.jeremyahenry.com/mailermanager/images/go-button.gif" name="submit" value="submit"><br> <input type="hidden" name="r" value="4"> <input type="hidden" name="a" value="sub"> <input type="hidden" name="ref" value="none"> <br> <font color="#003300">html: <input type="radio" name="h" value="1">yes <input type="radio" name="h" value="0" checked="checked">no<br> </font> </form> </td></tr> </table> </center> </body> </html>

form 2

<?php session_start(); ?> <html> <head> <title>request form</title> <style>p{font:10pt arial;}</style> </head> <body> <form action="contact_me/process.php" method=post> <table align=left border=0 height=300> <tr> <td nowrap> <p>&nbsp;&nbsp;&nbsp;&nbsp;your name:&nbsp;&nbsp; &nbsp;&nbsp;<input maxlength=25 name=name size=25> </td> </tr> <tr> <td nowrap> <p>&nbsp;&nbsp;&nbsp;&nbsp;your email:&nbsp;&nbsp; &nbsp;&nbsp;<input name=from size=25 maxlength=25> </td> </tr> <tr> <td colspan=2> <center> <p align=center>enter auction item name below: <br> <textarea cols=50 name=message rows=7></textarea> <p align=center> <input type=submit value="send message"> <input type=reset value=reset name="reset"> </td> </tr> </table> </form> </center> </body> </html>

ass can see code going utilize sessions. not familiar though have experience php still quite new , need help. want pars form info both forms. , product name form two. help on appreciated.. hope clear plenty 1 out there help.....

ok new code 3 forms 1.main form submits info form1 , form2. have set using session have: session.php

<?php session_start(); // store session info $_session['af_first_name'] = $af_first_name; $_session['af_last_name'] = $af_last_name; $_session['af_email'] = $af_email; $_session['cf_address'] = $cf_item_name; ?>

that handles variables. new code index.php

<?php // including session file require_once("session_start.php") ?> <?php function stripzlashes($string) { //this function strip slashes either array or string if (!is_array($string)) homecoming stripslashes($string); $nvar = array(); foreach ($string $key => $value) $nvar[stripslashes($key)] = stripzlashes($value); homecoming $nvar; } ?> </head> <body> <h2>winner aution item request form</h2> <p><span class="error"><font><font color="red">* required field.</font></span></p> <form name="form1"> first name: <input type="text" name="$af_first_name" id="af_first_name" value="<?php if(isset($_session['af_first_name'])){echo stripslashes($_session['af_first_name']); unset($_session['af_first_name']); } ?>" /><br> lastly name: <input type="text" name="$af_last_name" id="af_last_name" value="<?php if(isset($_session['af_last_name'])){echo stripslashes($_session['af_last_name']); unset($_session['af_last_name']); } ?>" /><br> e-mail: <input type="text" name="$af_email" id="af_email" value="<?php if(isset($_session['af_email'])){echo stripslashes($_session['af_email']); unset($_session['af_email']); } ?>" /><br> </form> <form name="form2">copy , paste auction name below!<br> product name <br><input type="text" name="$cf_item_name" id="cf_item_name" value="<?php if(isset($_session['cf_item_name'])){echo stripslashes($_session['cf_item_name']); unset($_session['cf_item_name']); } ?>" /><br> <input type="submit" value="submit" name="submit" onsubmit="form2.submit(); form3.submit();"></input>

that form takes input , sets session. session.php picks , places in variable form. here used strip underscores. , when goes form1 , form2 varables pick , fill in form. here new form1

<?php function stripzlashes($string) { //this function strip slashes either array or string if (!is_array($string)) homecoming stripslashes($string); $nvar = array(); foreach ($string $key => $value) $nvar[stripslashes($key)] = stripzlashes($value); homecoming $nvar; } if(!empty($_session['_mf'])): //strip possible slashes stripzlashes($_session['_mf']); endif; // including session file require_once("session_start.php") ?> <center> <table cellspacing="10" bgcolor="#cccccc" style="border: 0px solid #000000;"> <tr><td> <form action="http://newsletter.jeremyahenry.com//s.php" method=get> <strong><font color="#660000">your first name:</font></strong> <input type="text" id="$af_first_name" value="<?php echo (!empty($_session['_af']['af_first_name'])?$_session['_af']['af_first_name']:'') ?>" name="f" style="background-color : #ffffff" size=11 maxlength=40><br> <strong><font color="#660000">your lastly name:</font></strong> <input type="text" id="$af_last_name" value="<?php echo (!empty($_session['_af']['af_last_name'])?$_session['_af']['af_last_name']:'') ?>" name="l" style="background-color : #ffffff" size=11 maxlength=40><br> <strong><font color="#000066">email address:</font></strong><br> <input type="text" id="$af_email" value="<?php echo (!empty($_session['_af']['af_email'])?$_session['_af']['af_email']:'') ?>" name="e" style="background-color : #ffffff" size=20 maxlength=50> <input type="image" src="http://newsletter.jeremyahenry.com/images/go-button.gif" name="submit" value="submit"><br> <input type="hidden" name="r" value="4"> <input type="hidden" name="a" value="sub"> <input type="hidden" name="ref" value="none"> <br> <font color="#003300">html: <input type="radio" name="h" value="1">yes <input type="radio" name="h" value="0" checked="checked">no<br> </font></form> </td></tr></table> </center> <?php if(!empty($_session['_mf'])): unset($_session['_mf']); endif; ?>

form2:

<?php function stripzlashes($string) { //this function strip slashes either array or string if (!is_array($string)) homecoming stripslashes($string); $nvar = array(); foreach ($string $key => $value) $nvar[stripslashes($key)] = stripzlashes($value); homecoming $nvar; } if(!empty($_session['_mf'])): //strip possible slashes stripzlashes($_session['_mf']); endif; // including session file require_once("session_start.php") ?> <form action="process.php" method=post> <table align=left border=0 height=300> <tr> <td nowrap> <p>&nbsp;&nbsp;&nbsp;&nbsp;your name:&nbsp;&nbsp; &nbsp;&nbsp;<input maxlength=25 name="af first name" id="af_first_name" value="<?php echo (!empty($_session['_af']['af_first_name'])?$_session['_af']['af_first_name']:'') ?>" size=25> /> </td</tr> <tr> <td nowrap> <p>&nbsp;&nbsp;&nbsp;&nbsp;your email:&nbsp;&nbsp; &nbsp;&nbsp;<input name=af email id="af email" value="<?php echo (!empty($_session['_af']['af_email'])?$_session['_af']['af_email']:'') ?>" size=25 maxlength=25> /> </td></tr> <tr> <td colspan=2> <center> <p align=center>enter auction item name below: <br> <input name="cf item name" id="cf item name" value="<?php echo (!empty($_session['_cf']['cf_item_name'])?$_session['_cf']['cf_item_name']:'') ?>" rows="1" /> <p align=center> <input type=submit value="send message"> </td></tr></table> </form> </center>

ok have issue submitting correctly...

<form name="form1"> <input type="text" value="" name="somename" onkeyup="form2.somename.value=this.value" /> </form> <form name="form2"> <input type="text" value="" name="somename" /> </form>

check out above code. hope helpful. or if not result require. can brief requirements in reply.

php jquery forms scripting

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -